package com.yanqu.road.server.gameplayer;

import com.alibaba.fastjson.JSONObject;
import com.google.protobuf.AbstractMessage.Builder;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.entity.enums.eSeasonRewardType;
import com.yanqu.road.entity.event.EventTriggerArgs;
import com.yanqu.road.entity.language.LanguageType;
import com.yanqu.road.entity.player.UserInfo;
import com.yanqu.road.entity.task.TaskConditionInfo;
import com.yanqu.road.entity.task.TaskInfo;
import com.yanqu.road.logic.config.ChannelConfig;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.queue.AutoDriveQueue;
import com.yanqu.road.queue.ICommandQueue;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.gameplayer.module.activity.*;
import com.yanqu.road.server.gameplayer.module.activity.able.ActivityAbleModule;
import com.yanqu.road.server.gameplayer.module.activity.ad.AdActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.advertisement.AdvertisementActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.apprentice.ApprenticeModule;
import com.yanqu.road.server.gameplayer.module.activity.area.AreaWashePkModule;
import com.yanqu.road.server.gameplayer.module.activity.biaoju.ActivityBiaoJuModule;
import com.yanqu.road.server.gameplayer.module.activity.bowart.BowArtModule;
import com.yanqu.road.server.gameplayer.module.activity.bulletscreen.BulletScreenModule;
import com.yanqu.road.server.gameplayer.module.activity.businessdepart.BusinessDepartModule;
import com.yanqu.road.server.gameplayer.module.activity.businessreunion.BusinessReunionActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.busyfarming.BusyFarmingModule;
import com.yanqu.road.server.gameplayer.module.activity.carptrip.CarpTripModule;
import com.yanqu.road.server.gameplayer.module.activity.cat.CatModule;
import com.yanqu.road.server.gameplayer.module.activity.celebration.CelebrationModule;
import com.yanqu.road.server.gameplayer.module.activity.chefduel.ChefDuelActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.chefduel.ChefDuelPhase1Module;
import com.yanqu.road.server.gameplayer.module.activity.chess.ChineseChessModule;
import com.yanqu.road.server.gameplayer.module.activity.chess.ChineseChessPracticeModule;
import com.yanqu.road.server.gameplayer.module.activity.climbtower.ClimbTowerModule;
import com.yanqu.road.server.gameplayer.module.activity.common.CommonActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.commonteam.CommonTeamModule;
import com.yanqu.road.server.gameplayer.module.activity.commonwish.CommonWishModule;
import com.yanqu.road.server.gameplayer.module.activity.cookboy.CookBoyActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.curio.CurioModule;
import com.yanqu.road.server.gameplayer.module.activity.daomu.DaoMuActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.deepseafishing.DeepFishingModule;
import com.yanqu.road.server.gameplayer.module.activity.coupon.CouponActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.crosspasture.CrossPastureModule;
import com.yanqu.road.server.gameplayer.module.activity.diggold.DigGoldModule;
import com.yanqu.road.server.gameplayer.module.activity.doublespring.DoubleSpringActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.douluodalu.DouLuoDaLuModule;
import com.yanqu.road.server.gameplayer.module.activity.dragonboatrace.DragonBoatRaceModule;
import com.yanqu.road.server.gameplayer.module.activity.drawPictures.DrawPicturesActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.drink.DrinkModule;
import com.yanqu.road.server.gameplayer.module.activity.dunhuangshiku.DunHuangShiKuModule;
import com.yanqu.road.server.gameplayer.module.activity.eggs.EggsActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.entername.EnterNameActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.evefeast.EveFeastModule;
import com.yanqu.road.server.gameplayer.module.activity.fanxiuspring.FanXiuSpringModule;
import com.yanqu.road.server.gameplayer.module.activity.feast.ShanHeFeastModule;
import com.yanqu.road.server.gameplayer.module.activity.fellingtrees.FellingTreesModule;
import com.yanqu.road.server.gameplayer.module.activity.fivehero.FiveHeroModule;
import com.yanqu.road.server.gameplayer.module.activity.flowercard.FlowerCardsModule;
import com.yanqu.road.server.gameplayer.module.activity.flowerstudy.FlowerStudyModule;
import com.yanqu.road.server.gameplayer.module.activity.foxcard.FoxCardModule;
import com.yanqu.road.server.gameplayer.module.activity.fund.ActivityFundModule;
import com.yanqu.road.server.gameplayer.module.activity.game2048.PageantModule;
import com.yanqu.road.server.gameplayer.module.activity.gashapon.GashaponModule;
import com.yanqu.road.server.gameplayer.module.activity.ghost.GhostModule;
import com.yanqu.road.server.gameplayer.module.activity.goddess.GoddessModule;
import com.yanqu.road.server.gameplayer.module.activity.goldautumn.GoldAutumnModule;
import com.yanqu.road.server.gameplayer.module.activity.goldingotfund.GoldIngotFundModule;
import com.yanqu.road.server.gameplayer.module.activity.goodsLimit.GoodsLimitModule;
import com.yanqu.road.server.gameplayer.module.activity.gourdchild.GourdChildModule;
import com.yanqu.road.server.gameplayer.module.activity.gourdplant.GourdPlantModule;
import com.yanqu.road.server.gameplayer.module.activity.greattrade.GreatTradeModule;
import com.yanqu.road.server.gameplayer.module.activity.guagifts.GuaGiftsModule;
import com.yanqu.road.server.gameplayer.module.activity.guguoxunbao.GuGuoXunBaoModule;
import com.yanqu.road.server.gameplayer.module.activity.hanghai.HangHaiModule;
import com.yanqu.road.server.gameplayer.module.activity.harps.HarpsModule;
import com.yanqu.road.server.gameplayer.module.activity.hell.HellModule;
import com.yanqu.road.server.gameplayer.module.activity.holiday.HolidayActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.hongxian.HongXianActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.horserun.HorseRunActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.hsisland.HsIslandActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.huashigang.HuaShiGangModule;
import com.yanqu.road.server.gameplayer.module.activity.iceservergift.IceServerGiftModule;
import com.yanqu.road.server.gameplayer.module.activity.jianchuanghua.JianChuangHuaModule;
import com.yanqu.road.server.gameplayer.module.activity.jieshi.JieShiModule;
import com.yanqu.road.server.gameplayer.module.activity.jinli.JinLiModule;
import com.yanqu.road.server.gameplayer.module.activity.jiuzhou.JiuZhouModule;
import com.yanqu.road.server.gameplayer.module.activity.jumppot.HotpotJumpModule;
import com.yanqu.road.server.gameplayer.module.activity.langyamemorial.LangYaMemorialModule;
import com.yanqu.road.server.gameplayer.module.activity.langyabang.LangYaBangModule;
import com.yanqu.road.server.gameplayer.module.activity.lanruosi.LanRuoSiModule;
import com.yanqu.road.server.gameplayer.module.activity.liondance.LionDanceModule;
import com.yanqu.road.server.gameplayer.module.activity.lottery.ActivityLotteryModule;
import com.yanqu.road.server.gameplayer.module.activity.luckydraw.LuckyDrawModule;
import com.yanqu.road.server.gameplayer.module.activity.luckyshop.LuckyShopModule;
import com.yanqu.road.server.gameplayer.module.activity.mall.UserActivityMallTouchModule;
import com.yanqu.road.server.gameplayer.module.activity.mammonhall.MammonHallModule;
import com.yanqu.road.server.gameplayer.module.activity.memorypieces.MemoryPiecesModule;
import com.yanqu.road.server.gameplayer.module.activity.metaspace.MetaspaceModule;
import com.yanqu.road.server.gameplayer.module.activity.selectlottery.SelectLotteryModule;
import com.yanqu.road.server.gameplayer.module.activity.newserverwelfare.NewServerWelfareModule;
import com.yanqu.road.server.gameplayer.module.activity.newyear2023.FireWorkModule;
import com.yanqu.road.server.gameplayer.module.activity.newyearbag.NewYearBagModule;
import com.yanqu.road.server.gameplayer.module.activity.oldplayerreturn.OldPlayerReturnModule;
import com.yanqu.road.server.gameplayer.module.activity.operamask.OperaMaskModule;
import com.yanqu.road.server.gameplayer.module.activity.orewar.OreWarActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.patronsfund.PatronsFundModule;
import com.yanqu.road.server.gameplayer.module.activity.pasture.PastureModule;
import com.yanqu.road.server.gameplayer.module.activity.pawnshop.PawnshopModule;
import com.yanqu.road.server.gameplayer.module.activity.peakseacraft.PeakSeacraftModule;
import com.yanqu.road.server.gameplayer.module.activity.peakstronghold.PeakStrongholdModule;
import com.yanqu.road.server.gameplayer.module.activity.pixiu.PiXiuModule;
import com.yanqu.road.server.gameplayer.module.activity.platform.PlatformMailAntiActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.ppl.PplModule;
import com.yanqu.road.server.gameplayer.module.activity.qixi.QixiModule;
import com.yanqu.road.server.gameplayer.module.activity.qqprivilege.QQPrivilegeActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.rankunionwar.RankUnionWarModule;
import com.yanqu.road.server.gameplayer.module.activity.recallplayer.RecallPlayerModule;
import com.yanqu.road.server.gameplayer.module.activity.ruishou.RuiShouModule;
import com.yanqu.road.server.gameplayer.module.activity.seacraft.SeacraftPirateRiotModule;
import com.yanqu.road.server.gameplayer.module.activity.seacraft.SeacraftSouthSeaModule;
import com.yanqu.road.server.gameplayer.module.activity.festivalgift.FestivalGiftModule;
import com.yanqu.road.server.gameplayer.module.activity.shanshui.XingYouShanShuiModule;
import com.yanqu.road.server.gameplayer.module.activity.share.ShareModule;
import com.yanqu.road.server.gameplayer.module.activity.shrek.DouLuoShrekModule;
import com.yanqu.road.server.gameplayer.module.activity.shuihu.ShuiHuModule;
import com.yanqu.road.server.gameplayer.module.activity.shuihuyezicard.ShuiHuYeZiCardModule;
import com.yanqu.road.server.gameplayer.module.activity.shushanmodule.ShuShanModule;
import com.yanqu.road.server.gameplayer.module.activity.signindraw.SignInDrawModule;
import com.yanqu.road.server.gameplayer.module.activity.silkroad.SilkRoadModule;
import com.yanqu.road.server.gameplayer.module.activity.snowgarden.SnowGardenModule;
import com.yanqu.road.server.gameplayer.module.activity.sonhai.SonHaiActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.soulbone.SoulBoneModule;
import com.yanqu.road.server.gameplayer.module.activity.springdinner.SpringDinnerModule;
import com.yanqu.road.server.gameplayer.module.activity.springdraw.SpringDrawModule;
import com.yanqu.road.server.gameplayer.module.activity.springunionbanquet.SpringUnionBanquetModule;
import com.yanqu.road.server.gameplayer.module.activity.starlight.StarLightModule;
import com.yanqu.road.server.gameplayer.module.activity.stelesoul.SteleSoulModule;
import com.yanqu.road.server.gameplayer.module.activity.strongholdwar.StrongholdActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.strongholdwar.StrongholdModule;
import com.yanqu.road.server.gameplayer.module.activity.suitang.SuiTangModule;
import com.yanqu.road.server.gameplayer.module.activity.summergames.SummerGamesModule;
import com.yanqu.road.server.gameplayer.module.activity.summerquiz.SummerQuizModule;
import com.yanqu.road.server.gameplayer.module.activity.suoyao.SuoYaoModule;
import com.yanqu.road.server.gameplayer.module.activity.tanghulu.TangHuLuModule;
import com.yanqu.road.server.gameplayer.module.activity.taobao.TaoBaoModule;
import com.yanqu.road.server.gameplayer.module.activity.throwingPot.ThrowingPotModule;
import com.yanqu.road.server.gameplayer.module.activity.tomb.TombModule;
import com.yanqu.road.server.gameplayer.module.activity.tonbing.TonBingModule;
import com.yanqu.road.server.gameplayer.module.activity.tonbingchannel.ChannelTonBingModule;
import com.yanqu.road.server.gameplayer.module.activity.tongbing.ChuHanModule;
import com.yanqu.road.server.gameplayer.module.activity.tongbing.TongBingModule;
import com.yanqu.road.server.gameplayer.module.activity.toyhouse.ToyHouseModule;
import com.yanqu.road.server.gameplayer.module.activity.tradewar.TradeWarActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.travelbook.TravelBookModule;
import com.yanqu.road.server.gameplayer.module.activity.treasure.TreasureActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.turtle.TurtleModule;
import com.yanqu.road.server.gameplayer.module.activity.twins.TwinsModule;
import com.yanqu.road.server.gameplayer.module.activity.unionchest.UnionChestModule;
import com.yanqu.road.server.gameplayer.module.activity.unionwar.UnionWarActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.wanyao.WanYaoModule;
import com.yanqu.road.server.gameplayer.module.activity.washe.WasheModule;
import com.yanqu.road.server.gameplayer.module.activity.winterLove.WinterLoveModule;
import com.yanqu.road.server.gameplayer.module.activity.wishpool.WishPoolModule;
import com.yanqu.road.server.gameplayer.module.activity.witchDraw.WitchDrawModule;
import com.yanqu.road.server.gameplayer.module.activity.worldcup.WorldCupModule;
import com.yanqu.road.server.gameplayer.module.activity.xiaowuRecall.XiaowuRecallModule;
import com.yanqu.road.server.gameplayer.module.activity.xiayue.XiaYueModule;
import com.yanqu.road.server.gameplayer.module.activity.xiuxian.XiuXianModule;
import com.yanqu.road.server.gameplayer.module.activity.yearMaster.YearMasterModule;
import com.yanqu.road.server.gameplayer.module.activity.yingxin.YingXinModule;
import com.yanqu.road.server.gameplayer.module.activity.yuanbaolottery.YuanBaoLotteryModule;
import com.yanqu.road.server.gameplayer.module.activity.yqhotel.YqHotelModule;
import com.yanqu.road.server.gameplayer.module.activity.zhanling.ZhanLingActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.zhenhuan.ZhenHuanFirstProcessModule;
import com.yanqu.road.server.gameplayer.module.activity.zhenhuan.ZhenHuanSecondProcessModule;
import com.yanqu.road.server.gameplayer.module.activity.zhenhuan.ZhenHuanThirdProcessModule;
import com.yanqu.road.server.gameplayer.module.activity.zhounianturntable.ZhouNianTurntableModule;
import com.yanqu.road.server.gameplayer.module.assistant.AssistantModule;
import com.yanqu.road.server.gameplayer.module.assistant.AssistantSkinModule;
import com.yanqu.road.server.gameplayer.module.banquet.BanquetModule;
import com.yanqu.road.server.gameplayer.module.base.AbsGeneralModule;
import com.yanqu.road.server.gameplayer.module.base.GeneralModule;
import com.yanqu.road.server.gameplayer.module.beautyescort.BeautyEscortModule;
import com.yanqu.road.server.gameplayer.module.channelmusicroom.ChannelMusicRoomRankActivityModule;
import com.yanqu.road.server.gameplayer.module.charitable.CharitableModule;
import com.yanqu.road.server.gameplayer.module.chefduel.ChefDuelModule;
import com.yanqu.road.server.gameplayer.module.clinic.ClinicModule;
import com.yanqu.road.server.gameplayer.module.cmdstat.UserCommandStatistics;
import com.yanqu.road.server.gameplayer.module.cookboy.CookBoyModule;
import com.yanqu.road.server.gameplayer.module.creditpoints.CreditPointsModule;
import com.yanqu.road.server.gameplayer.module.cricket.CricketModule;
import com.yanqu.road.server.gameplayer.module.disperseGold.DisperseGoldModule;
import com.yanqu.road.server.gameplayer.module.drugstore.DrugStoreModule;
import com.yanqu.road.server.gameplayer.module.exchange.ExchangeModule;
import com.yanqu.road.server.gameplayer.module.giftKey.GiftKeyModule;
import com.yanqu.road.server.gameplayer.module.grandson.GrandChildModule;
import com.yanqu.road.server.gameplayer.module.guess.CommonGuessModule;
import com.yanqu.road.server.gameplayer.module.hunt.HuntModule;
import com.yanqu.road.server.gameplayer.module.inn.InnModule;
import com.yanqu.road.server.gameplayer.module.kowloon.KowloonModule;
import com.yanqu.road.server.gameplayer.module.kuang.KuangModule;
import com.yanqu.road.server.gameplayer.module.mail.MailModule;
import com.yanqu.road.server.gameplayer.module.mall.MallModule;
import com.yanqu.road.server.gameplayer.module.manor.ManorModule;
import com.yanqu.road.server.gameplayer.module.match.MatchModule;
import com.yanqu.road.server.gameplayer.module.messagesubscribe.MessageSubscribeModule;
import com.yanqu.road.server.gameplayer.module.minibind.WechatBindModule;
import com.yanqu.road.server.gameplayer.module.mogulbirthday.MogulBirthdayModule;
import com.yanqu.road.server.gameplayer.module.monopolymarket.MonopolyMarketModule;
import com.yanqu.road.server.gameplayer.module.musicroom.MusicRoomModule;
import com.yanqu.road.server.gameplayer.module.musicroom.MusicRoomRankActivityModule;
import com.yanqu.road.server.gameplayer.module.newmonopolymkt.NewMonopolyMarketModule;
import com.yanqu.road.server.gameplayer.module.npc.NpcEventModule;
import com.yanqu.road.server.gameplayer.module.palace.PalaceModule;
import com.yanqu.road.server.gameplayer.module.passRoad.PassRoadModule;
import com.yanqu.road.server.gameplayer.module.passRoad.PassTransportModule;
import com.yanqu.road.server.gameplayer.module.patrons.CombLeaderModule;
import com.yanqu.road.server.gameplayer.module.patrons.PatronsModule;
import com.yanqu.road.server.gameplayer.module.platform.PlatformUserModule;
import com.yanqu.road.server.gameplayer.module.player.*;
import com.yanqu.road.server.gameplayer.module.rebate.ChinaRebateModule;
import com.yanqu.road.server.gameplayer.module.rebate.RebateModule;
import com.yanqu.road.server.gameplayer.module.recharge.GoldTokenRechargeModule;
import com.yanqu.road.server.gameplayer.module.recharge.RechargeGainModule;
import com.yanqu.road.server.gameplayer.module.relatives.RelativesModule;
import com.yanqu.road.server.gameplayer.module.resource.GoodsResourceModule;
import com.yanqu.road.server.gameplayer.module.retrieveReward.RecoveryRewardModule;
import com.yanqu.road.server.gameplayer.module.sacrifice.SacrificeModule;
import com.yanqu.road.server.gameplayer.module.season.SeasonRewardModule;
import com.yanqu.road.server.gameplayer.module.sign.SignModule;
import com.yanqu.road.server.gameplayer.module.skin.SkinModule;
import com.yanqu.road.server.gameplayer.module.smallgame.SmallGameModule;
import com.yanqu.road.server.gameplayer.module.specialcookboy.SpecialCookBoyModule;
import com.yanqu.road.server.gameplayer.module.specialserver.IceServerModule;
import com.yanqu.road.server.gameplayer.module.specialtombrob.SpecialTombRobModule;
import com.yanqu.road.server.gameplayer.module.task.TaskModule;
import com.yanqu.road.server.gameplayer.module.thief.ThiefModule;
import com.yanqu.road.server.gameplayer.module.topiclink.TopicLinkModule;
import com.yanqu.road.server.gameplayer.module.travel.TravelModule;
import com.yanqu.road.server.gameplayer.module.triggerwindow.ActTriggerWindowModule;
import com.yanqu.road.server.gameplayer.module.union.cross.CrossUnionModule;
import com.yanqu.road.server.gameplayer.module.union.cross.CrossUnionTradeModule;
import com.yanqu.road.server.gameplayer.module.union.cross.UnionHuaBenModule;
import com.yanqu.road.server.gameplayer.module.unioncampwar.UnionCampWarModule;
import com.yanqu.road.server.gameplayer.module.useract.UserActModule;
import com.yanqu.road.server.gameplayer.module.vehicle.VehicleModule;
import com.yanqu.road.server.gameplayer.module.vehicle.VehicleSoulModule;
import com.yanqu.road.server.gameplayer.module.vehicle.VehicleBoneModule;
import com.yanqu.road.server.gameplayer.module.verification.VerificationModule;
import com.yanqu.road.server.gameplayer.module.wechatrank.WechatRankModule;
import com.yanqu.road.server.gameplayer.module.winery.WineryModule;
import com.yanqu.road.server.gameplayer.module.wineshop.WineShopModule;
import com.yanqu.road.server.gameplayer.module.wingroom.WingRoomChakraModule;
import com.yanqu.road.server.gameplayer.module.wingroom.WingRoomMessageModule;
import com.yanqu.road.server.gameplayer.module.wingroom.WingRoomModule;
import com.yanqu.road.server.gameplayer.module.workshop.WorkShopModule;
import com.yanqu.road.server.gameplayer.module.xiaomian.XiaoMianModule;
import com.yanqu.road.server.gameplayer.module.zhaoshang.ZsModule;
import com.yanqu.road.server.logic.season.BaseSeasonFactory;
import com.yanqu.road.server.logic.season.BaseSeasonReward;
import com.yanqu.road.server.manger.config.TaskMgr;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.manger.player.UserMgr;
import com.yanqu.road.server.manger.union.GameUnionActivityGroupMgr;
import com.yanqu.road.server.task.GameCommandTask;
import com.yanqu.road.utils.LocalDateTimeHelper;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.utils.config.Config;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.string.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.lang.reflect.Constructor;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class GamePlayer extends AbsGamePlayer implements ICommandQueue {

    protected static Logger log = LogManager.getLogger(GamePlayer.class.getName());

    private AutoDriveQueue<Runnable> commandQueue;

    private String ip;

    private String webSocketIp = "";

    private UserInfo userInfo;

    private String deviceId = "";

    private short state;// 玩家当前状态
    /**
     * 玩家最后一次ping的时间
     */
    private long lastPingTime;
    /**
     * 失去心跳次数
     */
    private int loseHeartTimes;
    /**
     * 上一次计算赚速的时间
     */
    private long lastCalEarnSpeedTime;

    private int phonePlatform;      //登录时候带上来的手机平台

    private String clientCurVer;    //客户端当前版本，登录时候带上来

    private String appId = ""; //子包id
    private String childGameId = ""; // 子游戏id

    private String k = "";
    private int rec = 0;
    private int send = 0;
    private JSONObject appExt = new JSONObject();     //json传值{"app_ext":}
    private long loginStartTime = System.currentTimeMillis();
    private boolean isLiveShow;                 //是否开直播
    private long liveShowStartTime;             //直播开始时间
    private long lastCalcLiveShowTime;          //上次计算直播时间
    private boolean isAllLoadCricketTask = false;   //是否全部加载蛐蛐任务

    /**
     * 上一次(最近)登录的时间
     */
    private long lastLoginTime;

    private int loginLinkType;   // 外链类型 1:瓦舍 2:卖鱼佬

    private String zfbChannel = "";   //支付宝活动渠道

    public int getRec() {
        return rec;
    }

    public void setRec(int rec) {
        this.rec = rec;
    }

    public int getSend() {
        return send;
    }

    public void setSend(int send) {
        this.send = send;
    }

    public String getK() {
        return k;
    }

    public void setK(String k) {
        this.k = k;
    }

    public GamePlayer(UserInfo userInfo) {
        this.userInfo = userInfo;
        UserMgr.setUserInfo(userInfo);
        this.lastPingTime = System.currentTimeMillis();
        commandQueue = new AutoDriveQueue<>(GameServer.getServerCommandExecutor());
        initModule();
        commandStatistics = new UserCommandStatistics(userInfo.getUserId());
    }

    private void initModule() {
        // 道具资源模块 放前面 稳
        addModule(new GoodsResourceModule(this));
        // 属性模块
        addModule(new AttributeModule(this));
        // 用户模块
        addModule(new PlayerModule(this));
        // 道具模块 千万别换顺序 CurrencyModule 在 PlayerModule 后面
        addModule(new CurrencyModule(this));
        // 通用活动模块
        addModule(new CommonActivityModule(this));
        // 灵猫活动
        addModule(new HolidayActivityModule(this));
        // 商会战活动
        addModule(new UnionWarActivityModule(this));
        //跨服商战活动模块
        addModule(new TradeWarActivityModule(this));
        // 活动商城模块
        addModule(new ActivityMallModule(this));
        // 交互模块
        addModule(new InteractiveModule(this));
        // 背包模块
        addModule(new BagModule(this));
        // 产业模块
        addModule(new BuildingModule(this));
        // 收藏阁模块(暂时没有用)
        addModule(new CollectionModule(this));
        // 充值首次购买的状态记录
        addModule(new RechargeGainModule(this));
        // 邮件模块
        addModule(new MailModule(this));
        //藏宝
        addModule(new CurioModule(this));
        // 门客模块
        addModule(new PatronsModule(this));
        //组合首领
        addModule(new CombLeaderModule(this));
        // 珍兽模块
        addModule(new VehicleModule(this));
        addModule(new VehicleSoulModule(this));
        addModule(new VehicleBoneModule(this));
        // 商城模块
        addModule(new MallModule(this));
        // 通用模块
        addModule(new CommonModule(this));
        // 充值模块
        addModule(new RechargeModule(this));
        addModule(new GoldTokenRechargeModule(this));
        // 美女模块
        addModule(new BeautyModule(this));
        // 子嗣模块
        addModule(new ChildModule(this));
        // 联姻模块
        addModule(new MarriageModule(this));
        //孙子模块
        addModule(new GrandChildModule(this));
        // 黑名单
        addModule(new BlacklistModule(this));
        // 聊天模块
        addModule(new ChatModule(this));
        // 商战模块
        addModule(new TradeWarModule(this));
        // 商战建筑模块
        addModule(new TradeWarBuildingModule(this));
        // 游历模块
        addModule(new TravelModule(this));
        // 签到模块
        addModule(new SignModule(this));
        // 矿场模块
        addModule(new MineWarModule(this));
        // 乔迁模块
        addModule(new EstateWarModule(this));
        // 钱庄模块
        addModule(new HouseModule(this));
        // 弹幕模块
        addModule(new BulletScreenModule(this));
        //潜力分
        addModule(new PotentialModule(this));
        // 活动弹窗触发记录模块
        addModule(new ActTriggerWindowModule(this));
        // 活动模块
        addModule(new ActivityModule(this));
        // 特权卡模块
        addModule(new CardModule(this));
        // 家族模块
        //addModule(new UnionModule(this));
        addModule(new CrossUnionModule(this));
        // 商业副业
        //addModule(new UnionParergonModule(this));
        // 商业副本
        addModule(new CrossUnionTradeModule(this));
        // 商会话本
        addModule(new UnionHuaBenModule(this));
        //招商
        addModule(new ZsModule(this));
        // 兑换模块
        addModule(new ExchangeModule(this));
        addModule(new GiftKeyModule(this));

        // 装饰模块 头像框称号之类..
        addModule(new DecorationModule(this));
        // 财神模块
        addModule(new MammonModule(this));
        // 狩猎模块
        addModule(new HuntModule(this));
        // 秋墟祭天模块
        addModule(new SacrificeModule(this));
        // 冷宫模块
        addModule(new ColdRoomModule(this));
        // 宴会模块
        addModule(new BanquetModule(this));
        // 亲家模块
        addModule(new RelativesModule(this));
        // 善财模块
        addModule(new DisperseGoldModule(this));
        // 活动善财
        addModule(new ActivityDisperseGoldModule(this));
        // 财神秘件
        addModule(new SecretVolumeModule(this));
        // 返利模块
        addModule(new RebateModule(this));
        // 国内返利模块
        addModule(new ChinaRebateModule(this));
        // 关卡模块
        addModule(new PassRoadModule(this));
        // 关卡模块
        addModule(new PassTransportModule(this));
        // 行善模块
        addModule(new CharitableModule(this));
        // 皮肤模块
        addModule(new SkinModule(this));
        // npc事件模块
        addModule(new NpcEventModule(this));
        // 盐场活动模块
        addModule(new OreWarActivityModule(this));
        // 盐场模块
        addModule(new OreWarModule(this));
        // 预扣除模块
        addModule(new PreReduceModule(this));
        // 花石纲模块
        addModule(new HuaShiGangModule(this));
        addModule(new PageantModule(this));
        // 投壶模块
        addModule(new ThrowingPotModule(this));
        // 客栈经营模块
        addModule(new InnModule(this));
        // 平台道具模块
        addModule(new PlatformGoodsModule(this));
        // 许愿池模块
        addModule(new WishPoolModule((this)));
        // 瑞兽降福模块
        addModule(new YearMasterModule(this));
        // 灵狐送宝模块
        addModule(new TreasureActivityModule(this));
        // 泡泡龙模块
        addModule(new PplModule(this));
        // 剪窗花模块
        addModule(new JianChuangHuaModule(this));
        //绘年画模块
        addModule(new DrawPicturesActivityModule(this));
        // 糖葫芦
        addModule(new TangHuLuModule(this));
        //医馆模块
        addModule(new ClinicModule(this));
        //弓术大会
        addModule(new BowArtModule(this));
        //古国寻宝
        addModule(new GuGuoXunBaoModule(this));
        //月满金秋
        addModule(new GoldAutumnModule(this));
        //大佬生辰
        addModule(new MogulBirthdayModule(this));
        // 实物奖励(活动)
        addModule(new ActivityRealRewardModule(this));
        //周年签到实物抽奖
        addModule(new SignInDrawModule(this));

        // 赛龙舟
        addModule(new DragonBoatRaceModule(this));
        //战令
        addModule(new ZhanLingActivityModule(this));
        // 永安当模块
        addModule(new PawnshopModule(this));

        //据点战模块
        addModule(new StrongholdActivityModule(this));
        addModule(new StrongholdModule(this));
        addModule(new ActivityDigModule(this));
        addModule(new ActivityTrystModule(this));
        //杂艺模块
        addModule(new MatchModule(this));
        // 水浒卡模块
        addModule(new ShuiHuModule(this));
        // 农忙季
        addModule(new BusyFarmingModule(this));
        //快速出战模块
        addModule(new TradeWarTeamModule(this));
        // 鬼市
        addModule(new GhostModule(this));
        // 锁妖塔模块
        addModule(new SuoYaoModule(this));
        // 敦煌石窟
        addModule(new DunHuangShiKuModule(this));
        // 中華小當家
        addModule(new RelationActivityModule(this));
        addModule(new CookBoyActivityModule(this));
        addModule(new CookBoyModule(this));
        //财神殿
        addModule(new MammonHallModule(this));
        // 兰若寺
        addModule(new LanRuoSiModule(this));
        // 葫芦镇妖
        addModule(new GourdChildModule(this));
        // 葫芦山
        addModule(new GourdPlantModule(this));
        // 斗罗大陆
        addModule(new DouLuoDaLuModule(this));
        // 吞财貔貅
        addModule(new PiXiuModule(this));
        // 小偷系统
        addModule(new ThiefModule(this));
        // 大航海模块
        addModule(new HangHaiModule(this));
        // 饮子摊模块
        addModule(new DrinkModule(this));
        //霓裳卷
        addModule(new SkinVolumeModule(this));
        //庄园
        addModule(new ManorModule(this));
        //厢房 放庄园后面
        addModule(new WingRoomModule(this));
        //工坊
        addModule(new WorkShopModule(this));
        addModule(new WingRoomMessageModule(this));
        // 夏越模块
        addModule(new XiaYueModule(this));
        // 周年庆典
        addModule(new CelebrationModule(this));
        //美女走镖
        addModule(new BeautyEscortModule(this));
        //小面
        addModule(new XiaoMianModule(this));
        //冬季恋歌
        addModule(new WinterLoveModule(this));
        // 迎新夜宴
        addModule(new YingXinModule(this));
        addModule(new ShareModule(this));
        //斗罗大陆小舞回忆录
        addModule(new XiaowuRecallModule(this));
        //琅琊榜
        addModule(new LangYaBangModule(this));
        // 跨地区活动
        addModule(new ChannelActivityModule(this));
        // 跨区域冲榜
        addModule(new ActivityAbleModule(this));
        //小助手换装模块
        addModule(new AssistantSkinModule(this));
        // 广告活动模块
        addModule(new AdActivityModule(this));
        //小游戏的广告模块
        addModule(new AdvertisementActivityModule(this));
        //优惠券模块
        addModule(new CouponModule(this));
        addModule(new CouponActivityModule(this));
        //不要放这边后面了,放 EarnSpeedModule 之前
        //妙音坊
        addModule(new MusicRoomModule(this));
        // 任务模块
        addModule(new TaskModule(this));
        // 赚速模块
        addModule(new EarnSpeedModule(this));
        addModule(new WineShopModule(this));
        //榷场
        addModule(new MonopolyMarketModule(this));

        //地府断案
        addModule(new HellModule(this));
        // 水浒叶子牌
        addModule(new ShuiHuYeZiCardModule(this));
        // 药铺
        addModule(new DrugStoreModule(this));

        //年夜饭
        addModule(new SpringDinnerModule(this));
        //象棋大逃杀
        addModule(new ChineseChessModule(this));
        addModule(new ChineseChessPracticeModule(this));
        //癫疯商会战
        addModule(new RankUnionWarModule(this));

        addModule(new TwinsModule(this));

        //小助理
        addModule(new AssistantModule(this));
        //老玩家回归
        addModule(new OldPlayerReturnModule(this));

        //斗罗斯瑞克学院
        addModule(new DouLuoShrekModule(this));
        addModule(new TaoBaoModule(this));
        // 海上争霸 南海丝路
        addModule(new SeacraftSouthSeaModule(this));
        //皇城
        addModule(new PalaceModule(this));

        // 海盗之乱
        addModule(new SeacraftPirateRiotModule(this));
        // 玩具屋
        addModule(new ToyHouseModule(this));
        // 蜀山
        addModule(new ShuShanModule(this));
        //元宇宙
        addModule(new MetaspaceModule(this));
        //商海重逢
        addModule(new BusinessReunionActivityModule(this));
        //琅琊祭奠
        addModule(new LangYaMemorialModule(this));
        //汴梁达人
        addModule(new RecallPlayerModule(this));

        //扣除元宝
        addModule(new DeductIngotsModule(this));

        //扣除元宝
        addModule(new ReduceItemModule(this));

        // 记忆碎片
        addModule(new MemoryPiecesModule(this));

        // 金玉宝盘
        addModule(new ZhouNianTurntableModule(this));
        // 统兵演武
        addModule(new TongBingModule(this));
        // 不良积分
        addModule(new CreditPointsModule(this));

        addModule(new ClimbTowerModule(this));

        addModule(new PlatformUserModule(this));

        //用户扩展字段
        addModule(new ExtensionModule(this));
        //酒坊模式
        addModule(new WineryModule(this));

        // 畅音阁
        addModule(new OperaMaskModule(this));

        // 牧场点兵
        addModule(new PastureModule(this));

        //屠苏宴饮
        addModule(new SpringUnionBanquetModule(this));

        //鉴别魂骨
        addModule(new SoulBoneModule(this));

        // 牧场点兵(跨地区)
        addModule(new CrossPastureModule(this));
        addModule(new AreaWashePkModule(this));

        // 蛐蛐系统
        addModule(new CricketModule(this));

        // 徽章(这个模块在有相应的徽章系统之后，鱼塘、厢房、药铺、酒坊)
        addModule(new BadgeModule(this));

        addModule(new PlatformMailAntiActivityModule(this));
        //新服福利
        addModule(new NewServerWelfareModule(this));
        // 吴刚伐桂
        addModule(new FellingTreesModule(this));
        // 广府联动
        addModule(new LionDanceModule(this));

        addModule(new TombModule(this));

        addModule(new GreatTradeModule(this));
        //歇脚小铺
        addModule(new SmallGameModule(this));

        // 瓦舍夺魁
        addModule(new WasheModule(this));

        // 赛季奖励
        addModule(new SeasonRewardModule(this));
        addModule(new EggsActivityModule(this));

        addModule(new CatModule(this));
        //汴梁世界杯
        addModule(new WorldCupModule(this));
        // 实物奖励
        addModule(new RealRewardModule(this));
        // 幸运签
        addModule(new LuckyDrawModule(this));
        addModule(new DailyDataModule(this));

        addModule(new PeakStrongholdModule(this));

        addModule(new CarpTripModule(this));

        addModule(new NewYearBagModule(this));

        addModule(new FireWorkModule(this));

        addModule(new FanXiuSpringModule(this));

        addModule(new ActivityLotteryModule(this));

        addModule(new CommonWishModule(this));

        addModule(new XiuXianModule(this));

        addModule(new FlowerCardsModule(this));

        addModule(new JieShiModule(this));
        addModule(new PeakSeacraftModule(this));

        addModule(new VerificationModule(this));

        // 巅峰统兵演武
        addModule(new TonBingModule(this));
        // 跨域统兵演武
        addModule(new ChannelTonBingModule(this));

        //商会宝箱活动
        addModule(new UnionChestModule(this));

        addModule(new GoddessModule(this));
        addModule(new RecoveryRewardModule(this));

        //地区报名活动，仅冲榜
        addModule(new EnterNameActivityModule(this));

        addModule(new UnionActivityGroupModule(this));
        //深海觅诊
        addModule(new DeepFishingModule(this));

        addModule(new FiveHeroModule(this));

        addModule(new MessageSubscribeModule(this));

        // 九龙城寨
        addModule(new KowloonModule(this));

        //南海丝路
        addModule(new SilkRoadModule(this));

        addModule(new KuangModule(this));
        addModule(new UnionCampWarModule(this));

        //小当家特色服
        addModule(new SpecialCookBoyModule(this));

        addModule(new FlowerStudyModule(this));

        //自选商品礼包
        addModule(new FestivalGiftModule(this));

        addModule(new ShanHeFeastModule(this));

        addModule(new WanYaoModule(this));

        addModule(new QixiModule(this));
        addModule(new GuaGiftsModule(this));

        addModule(new NewMonopolyMarketModule(this));

        addModule(new TopicLinkModule(this));

        addModule(new DigGoldModule(this));

        //盗墓笔记特色服
        addModule(new SpecialTombRobModule(this));

        addModule(new EveFeastModule(this));

        //盗墓笔记
        addModule(new DaoMuActivityModule(this));

        //新门客基金
        addModule(new PatronsFundModule(this));

        addModule(new WitchDrawModule(this));

        // 活动道具使用上限
        addModule(new GoodsLimitModule(this));

        // 锦鲤签
        addModule(new JinLiModule(this));

        // 石碑注魂
        addModule(new SteleSoulModule(this));

        //厢房命盘
        addModule(new WingRoomChakraModule(this));

        addModule(new WechatBindModule(this));

        //妙音坊冲榜活动
        addModule(new MusicRoomRankActivityModule(this));

        // 九州棋局
        addModule(new JiuZhouModule(this));

        // 冰雪游园
        addModule(new SnowGardenModule(this));

        addModule(new ActivityFundModule(this));

        addModule(new LuckyShopModule(this));

        // 祥瑞赐福
        addModule(new RuiShouModule(this));

        // 夏日运动会
        addModule(new SummerGamesModule(this));
        addModule(new SummerQuizModule(this));

        //踏春游记
        addModule(new DoubleSpringActivityModule(this));

        // 甄嬛传
        addModule(new ZhenHuanFirstProcessModule(this));
        addModule(new ZhenHuanSecondProcessModule(this));
        addModule(new ZhenHuanThirdProcessModule(this));

        addModule(new ActivityWorshipModule(this));

        addModule(new ActivityCivilRewardModule(this));

        addModule(new ActivityBiaoJuModule(this));

        //花袭春意
        addModule(new SpringDrawModule(this));

        // 代金券
        addModule(new VoucherModule(this));

        // 逐鹿隋唐
        addModule(new SuiTangModule(this));

        // 高山鸣琴
        addModule(new HarpsModule(this));

        //通用竞猜
        addModule(new CommonGuessModule(this));

        //微信排行
        addModule(new WechatRankModule(this));

        //商途启程
        addModule(new BusinessDepartModule(this));

        //QQ特权
        addModule(new QQPrivilegeActivityModule(this));

        addModule(new FoxCardModule(this));

        //红仙
        addModule(new HongXianActivityModule(this));

        //通用组队
        addModule(new CommonTeamModule(this));

        //山海伏兽
        addModule(new SonHaiActivityModule(this));

        //海神岛
        addModule(new HsIslandActivityModule(this));

        // 乌龟对对碰
        addModule(new TurtleModule(this));

        //小马快跑
        addModule(new HorseRunActivityModule(this));

        //元宝多多基金（签到基金）
        addModule(new GoldIngotFundModule(this));

        //玩家维度活动相关数据
        addModule(new UserActModule(this));

        //跳棋火锅
        addModule(new HotpotJumpModule(this));

        // 幸运扭蛋
        addModule(new GashaponModule(this));

        // 星星点灯
        addModule(new StarLightModule(this));

        //爱徒养成
        addModule(new ApprenticeModule(this));

        //元宝招财
        addModule(new YuanBaoLotteryModule(this));

        //新财神密卷
        addModule(new WealthScrollModule(this));

        // 旅行册
        addModule(new TravelBookModule(this));

        addModule(new XingYouShanShuiModule(this));

        addModule(new ChuHanModule(this));

        addModule(new UserActivityMallTouchModule(this));

        addModule(new ChefDuelActivityModule(this));
        addModule(new ChefDuelModule(this));

        // 寒冬汴梁
        addModule(new IceServerModule(this));

        addModule(new  ChefDuelPhase1Module(this));

        //阳泉酒家 (史莱克)
        addModule(new YqHotelModule(this));

        //通用自选抽奖
        addModule(new SelectLotteryModule(this));

        // 寒冬馈赠
        addModule(new IceServerGiftModule(this));

        addModule(new ChannelMusicRoomRankActivityModule(this));
    }

    @Override
    public AutoDriveQueue<Runnable> getCommandQueue() {
        if (commandQueue == null) {
            commandQueue = new AutoDriveQueue<>(GameServer.getServerCommandExecutor());
        }
        return commandQueue;
    }

    public void addCommandTask(GameCommandTask commandTask) {
        if (commandQueue == null) {
            commandQueue = new AutoDriveQueue<>(GameServer.getServerCommandExecutor());
        }
        commandQueue.add(commandTask);
    }

    @Override
    public void addModule(AbsGeneralModule module) {
        super.addModule(module);
    }

    @Override
    public List<AbsGeneralModule> getModuleList() {
        return super.getModuleList();
    }

    @SuppressWarnings("rawtypes")
    public boolean loadData() {
        for (AbsGeneralModule module : getModuleList()) {
            try {
                boolean result = ((GeneralModule) module).loadData();
            } catch (Exception e) {
                log.error(module.getClass().getName(), e);
                return false;
            }
        }
        return true;
    }

    @SuppressWarnings("rawtypes")
    public void afterLoadData() {
        for (AbsGeneralModule module : getModuleList()) {
            try {
                ((GeneralModule) module).afterLoadData();
            } catch (Exception e) {
                log.error(module.getClass().getName(), e);
            }
        }
    }

    @SuppressWarnings("rawtypes")
    public void saveData() {
        for (AbsGeneralModule module : getModuleList()) {
            try {
                long begin;
                long cost;
                synchronized (module.getSaveLockObj()) {//加锁，单次执行
                    begin = System.currentTimeMillis();
                    ((GeneralModule) module).saveData();
                    cost = System.currentTimeMillis() - begin;
                }
                warnSlowSave(module, cost);
            } catch (Exception e) {
                log.error(module.getClass().getName(), e);
            }
        }
    }

    private void warnSlowSave(AbsGeneralModule module, long cost) {
        if (cost > 100) {
            long userId = 0;
            if (null != userInfo) {
                userId = userInfo.getUserId();
            }
            log.warn("save too long time, userId {}, module: {} , cost : {}", userId, module.getModuleClass().getSimpleName(), cost);
        }
    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    public <T> T getModule(Class<T> T) {
        GeneralModule resultModule = (GeneralModule) moduleMap.get(T);
        if (null == resultModule) {
            try {
                Constructor<T> constructor = T.getConstructor(GamePlayer.class);
                resultModule = (GeneralModule) constructor.newInstance(this);
                addModule(resultModule);
            } catch (Exception e) {
                log.error(T.getName(), e);
            }
            log.error("no init module:{}" , T.getName());
        }
        return (T) resultModule;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        if (StringUtils.isNullOrEmpty(this.ip)) {
            this.ip = ip;
        }
    }

    public String getWebSocketIp() {
        return webSocketIp;
    }

    public void setWebSocketIp(String webSocketIp) {
        if (StringUtils.isNullOrEmpty(webSocketIp)) {
            return;
        }
        this.webSocketIp = webSocketIp;
    }

    public long getUserId() {
        if (null != userInfo) {
            return userInfo.getUserId();
        }
        return 0;
    }

    public int getTitleId() {
        if (null != userInfo) {
            return userInfo.getTitleId();
        }
        return 0;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public short getState() {
        return state;
    }

    public void setState(short state) {
        this.state = state;
    }

    public String getLanguage() {
        return userInfo.getLanguage();
    }

    public void setLanguage(String language) {
        if (StringUtils.isNullOrEmpty(language)) {
            userInfo.setLanguage(LanguageType.LANGUAGE_DEFAULT);
        } else {
            userInfo.setLanguage(language);
        }
    }

    public long getLastPingTime() {
        return lastPingTime;
    }

    public void setLastPingTime(long lastPingTime) {
        this.lastPingTime = lastPingTime;
        this.loseHeartTimes = 0;
    }

    public int getLoseHeartTimes() {
        return loseHeartTimes;
    }

    public void setLoseHeartTimes(int loseHeartTimes) {
        this.loseHeartTimes = loseHeartTimes;
    }

    public int getPhonePlatform() {
        return phonePlatform;
    }

    public void setPhonePlatform(int phonePlatform) {
        this.phonePlatform = phonePlatform;
    }

    public String getClientCurVer() {
        return clientCurVer;
    }

    public void setClientCurVer(String clientCurVer) {
        this.clientCurVer = clientCurVer;
    }

    public void setUserLocation() {
        if (ChannelConfig.LOCATION_OPEN > 0) {
            this.getModule(PlayerModule.class).setIp(ip);
        }
    }

    public void unLoadData() {
    }

    public void sendPacket(int code, Builder<?> messageBuilder) {
        YanQuMessage pkg = YanQuMessageUtils.buildMessage(code, messageBuilder);
        if (Config.isDebug()) {
            if (!Config.isIgnore(code)) {
                try {
                    log.info("-------------发送消息--------{} ", code);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        sendPacket(pkg);
    }

    public void sendUnionActivityGroupPacket(int code, Builder<?> messageBuilder, int activityId) {
        // 拿一下分组ID
        int groupId = GameUnionActivityGroupMgr.getGroupId(activityId, getUserId());

        sendUnionActivityGroupPacket(code, messageBuilder, activityId, groupId);
    }

    // 指定groupId，避免分组还没同步到时就需要发
    public void sendUnionActivityGroupPacket(int code, Builder<?> messageBuilder, int activityId, int groupId) {
        if (Config.isDebug()) {
            if (!Config.isIgnore(code)) {
                try {
                    log.info("-------------发送商会活动消息--------{} ", code);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        GamePlayerMgr.sendUnionActivityGroupPacket(code, messageBuilder, getUserId(), activityId, groupId);
    }

    public void sendChannelPacket(int code, Builder<?> messageBuilder) {
        GamePlayerMgr.sendChannelPacket(code, messageBuilder, getUserId());
    }

    /**
     * 保证跨域解包固定获得渠道和区服数据,跨域服用CrossChannelCommand接收
     *
     */
    public void sendChannelPlayerPacket(int code, Builder<?> messageBuilder) {
        GamePlayerMgr.sendChannelPlayerPacketEx(code, messageBuilder, getUserId());
    }

    public YanQuMessage getPacketMsg(int code, Builder<?> messageBuilder) {
        YanQuMessage pkg = YanQuMessageUtils.buildMessage(code, messageBuilder);
        return pkg;
    }

    public void sendPacket(YanQuMessage message) {
        GamePlayerMgr.sendPacket(this, message);
    }

    public void sendLoginMessage() {
        for (AbsGeneralModule module : getModuleList()) {
            try {
                ((GeneralModule) module).loginSendMsg();
            } catch (Exception e) {
                log.error(module.getClass().getName(), e);
            }
        }
    }

    /**
     * 通知任务
     */
    public void notifyListener(int eventType, Object object) {
        if(eGamePlayerEventType.CricketUpTitle.getValue() == eventType){
            if(!isAllLoadCricketTask) {
                TaskModule taskModule = getModule(TaskModule.class);
                Map<Integer, TaskInfo> taskInfoMap = TaskMgr.getTaskMap();
                if (null != taskInfoMap) {
                    for (TaskInfo taskInfo : taskInfoMap.values()) {
                        TaskConditionInfo taskConditionInfo = TaskMgr.getTaskConditionById(taskInfo.getTaskId());
                        if (null != taskConditionInfo && taskConditionInfo.getType() == 271) {
                            taskModule.addTask(taskInfo);
                        }
                    }
                }
                isAllLoadCricketTask = true;
            }
        }
        getModule(TaskModule.class).getGameEvent().notifyListener(eventType, new EventTriggerArgs(object));
    }

    /**
     * 同步太多次了客户端刷爆了，这个方法会触发后最后再触发一次同步
     * 要用这个方法记得把condition的setValue改了啊
     *
     * @param eventType
     * @param object
     */
    public void notifyListenerAndSync(int eventType, Object object) {
        getModule(TaskModule.class).getGameEvent().notifyListener(eventType, new EventTriggerArgs(object));
        getModule(ActivityModule.class).syncChangedActivityData();
    }

    /**
     * 通知任务
     */
    public void notifyListener(int eventType) {
        notifyListener(eventType, null);
    }

    /**
     * 通知赛季任务
     */
    public void notifySeasonReward(eSeasonRewardType type, Object param) {
        BaseSeasonReward instance = BaseSeasonFactory.getInstance(type, this);
        if (instance != null) {
            instance.handle(param);
        }
    }

    public long getLastCalEarnSpeedTime() {
        return lastCalEarnSpeedTime;
    }

    public void setLastCalEarnSpeedTime(long lastCalEarnSpeedTime) {
        this.lastCalEarnSpeedTime = lastCalEarnSpeedTime;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        if (StringUtils.isNullOrEmpty(deviceId)) {
            return;
        }
        this.deviceId = deviceId;
    }

    /**
     * 登录之后执行的逻辑
     */
    public void afterLogin() {
        for (AbsGeneralModule module : getModuleList()) {
            try {
                ((GeneralModule) module).afterLogin();
            } catch (Exception e) {
                log.error(module.getClass().getName(), e);
            }
        }
    }

    long lastRequestTime;

    /**
     * 是否访问过快
     *
     * @return
     */
    public boolean isRequestToFast() {
        long nowTime = System.currentTimeMillis();
        boolean stat = false;
        if (nowTime - lastRequestTime <= 500) {
            stat = true;
        }
        lastRequestTime = nowTime;
        return stat;
    }

    /**
    * 描述：记录在线时长
    * 作者：zrq
    * 时间：2022/8/20
    * 参数：

    * 返回值：
    **/
    public synchronized void logOnlineTime(){
        long nowTime = System.currentTimeMillis();
        long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp(nowTime);              //当前0点
        long loginStartZeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp(loginStartTime);     //登录时0点
        if(zeroTime != loginStartZeroTime){//跨天了
            nowTime = zeroTime;
            zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp(nowTime - 1);
        }
        long onlineTime = nowTime - loginStartTime;
        loginStartTime = nowTime;
        getModule(SignModule.class).logOnlineTime(zeroTime, onlineTime);
    }

    public void loggerErrorSql() {
        for (AbsGeneralModule module : getModuleList()) {
            try {
                ((GeneralModule) module).printErrorSqlDataFromMemory();
            } catch (Exception e) {
                log.error(module.getClass().getName(), e);
            }
        }
    }

    /**
     * 如果是新号 判断部分数据是否需要保存 true 为不需要保存
     * @return
     */
    public boolean isNewRoleNotSave() {
//        UserHouse userHouse = getModule(HouseModule.class).getUserHouse();
//        if (userHouse.getTotalClickTimes() == 0) {
//            // 没有点击过钱庄 数据则不保存
//            return true;
//        }
        if (userInfo.getTitleId() == 1) {
            return true;
        }
        return false;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getChildGameId() {
        return childGameId;
    }

    public void setChildGameId(String childGameId) {
        this.childGameId = childGameId;
    }

    public JSONObject getAppExt() {
        return appExt;
    }

    public void setAppExt(JSONObject appExt) {
        this.appExt = appExt;
    }

    public long getLoginStartTime() {
        return loginStartTime;
    }

    public boolean isLiveShow() {
        return isLiveShow;
    }

    public void setLiveShow(boolean liveShow) {
        isLiveShow = liveShow;
    }

    public long getLiveShowStartTime() {
        return liveShowStartTime;
    }

    public void setLiveShowStartTime(long liveShowStartTime) {
        this.liveShowStartTime = liveShowStartTime;
    }

    public long getLastCalcLiveShowTime() {
        return lastCalcLiveShowTime;
    }

    public void setLastCalcLiveShowTime(long lastCalcLiveShowTime) {
        this.lastCalcLiveShowTime = lastCalcLiveShowTime;
    }

    public synchronized void setLiveShow(){
        if(!isLiveShow){//非开播状态
            long nowTime = System.currentTimeMillis();
            setLiveShowStartTime(nowTime);			//设置开播开始时间
            setLastCalcLiveShowTime(nowTime);
            setLiveShow(true);						//设置开播状态
        }
    }

    public long getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(long lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public int getLoginLinkType() {
        return loginLinkType;
    }

    public void setLoginLinkType(int loginLinkType) {
        this.loginLinkType = loginLinkType;
    }

    public String getZfbChannel() {
        return zfbChannel;
    }

    public void setZfbChannel(String zfbChannel) {
        this.zfbChannel = zfbChannel;
    }

    /**
     * key:cmdcode  value:time 毫秒
     */
    private Map<Long, Long> lastRequestCmdTimeMap = new ConcurrentHashMap<>();

    /**
     * 指定请求是否请求过快
     * @param cmdCode
     * @param interval
     * @return
     */
    public boolean isRequestCmdTooFast(long cmdCode, int interval) {
        long nowTime = System.currentTimeMillis();
        Long lastTime = lastRequestCmdTimeMap.get(cmdCode);
        if (lastTime != null && nowTime - lastTime <= interval) {
            return true;
        }
        lastRequestCmdTimeMap.put(cmdCode, nowTime);
        return false;
    }

    protected UserCommandStatistics commandStatistics;

    public UserCommandStatistics getCommandStatistics() {
        return commandStatistics;
    }


    public void notifyObjectListener(int eventType, int objectId) {
        getModule(TaskModule.class).getGameObjectEvent().notifyListener(eventType, objectId);
    }
    public void notifyObjectListener(int eventType, int objectId, Object object) {
        getModule(TaskModule.class).getGameObjectEvent().notifyListener(eventType, objectId, new EventTriggerArgs(object));
    }

    public int checkObjectTaskComplete(int eventType, int objectId, int taskId) {
        return getModule(TaskModule.class).getGameObjectEvent().checkObjectTaskComplete(eventType, objectId, taskId);
    }

    public Property objectTaskFinish(int completeType, int objectId, Integer taskId) {
        return getModule(TaskModule.class).getGameObjectEvent().objectTaskFinish(completeType, objectId, taskId);
    }
}
